﻿namespace Core.Helper
{
    public class PagerUtil
    {
        /// <summary>
        /// 分页信息显示
        /// </summary>
        /// <param name="CurrentPageIndex"></param>
        /// <param name="PageSize"></param>
        /// <param name="RecordCount"></param>
        /// <param name="PageCount"></param>
        /// <returns></returns>
        public static string ShowPagerInfo(int CurrentPageIndex, int PageSize, int RecordCount, int PageCount)
        {
            int endcount = 0, startcount = 0;

            if (RecordCount > CurrentPageIndex * PageSize)
            {
                endcount = CurrentPageIndex * PageSize;
                startcount = (CurrentPageIndex - 1) * PageSize + 1;
            }
            else
            {
                endcount = RecordCount;
                startcount = (CurrentPageIndex - 1) * PageSize + 1;
            }
            return string.Format("显示第{0}-{1}条，每页{2}条，当前第{3}页/共{4}页", startcount, endcount, PageSize, CurrentPageIndex, PageCount);
        }
    }
}
